import request from "@/utils/request/request";

// 用户登录
export function appLogin(data) {
  return request({
    url: "/users/login",
    method: "post",
    data,
  });
}

/**
 * 获取用户信息
 * @param data
 * @returns {*}
 */
export function getUserInfo(data) {
  return request({
    url: "/users/info",
    method: "get",
    params: data,
  });
}

export function uploadImg(data) {
  return request({
    url: "/upload",
    method: "post",
    processData: false, //必须 缓存关了
    contentType: false, //必须 关闭 设置 数据格式（以 数据本身格式为准 xxxxx urlencoded）
    data,
  });
}

/**
 * 将图片地址保存到表中
 * @param data
 * @returns {*}
 */
export function adduploadImg(data) {
  return request({
    url: "/users/addImage",
    method: "post",
    data,
  });
}

/**
 * 查询出所有上传的图片
 * @param data
 * @returns {*}
 */
export function getPhotoAll(data) {
  return request({
    url: "/users/getAllPhoto",
    method: "get",
    params: data,
  });
}

/**
 * 查询个人中心 自己的作品和收藏
 * @param data
 * @returns {*}
 */
export function getUserFollowPhoto(data) {
  return request({
    url: "/users/getUserPhotoFollow",
    method: "get",
    params: data,
  });
}

/**
 * 个人中心删除个人作品
 * @param data
 * @returns {*}
 */
export function deleteUserContent(data) {
  return request({
    url: "/users/delUserContent",
    method: "get",
    params: data,
  });
}
/**
 * 设置喜欢
 * */
export function setPhotoLike(data) {
  return request({
    url: "/users/setPhotoLike",
    method: "post",
    data,
  });
}
